<div data-ng-controller="BookmarkController as vm" ng-init="vm.all()">
    <div class="mx-auto">
        <h2 class="text-center">BookmarkIT!</h2>
    </div>
    <div>
        <form class="mt-5 form-inline justify-content-center" role="form" ng-submit="vm.create()">
            <div class="form-group mx-sm-3 mr-1 mb-2">
                <label for="url" class="sr-only">URL</label>
                <input ng-model="vm.bookmark.url" type="text" class="form-control form-control-lg" id="url" placeholder="Add URL...">
            </div>
            <button id="add" type="submit" class="btn btn-primary btn-lg mb-2"><strong>+</strong></button>
        </form>
    </div>
    <div ng-show="vm.error" class="alert alert-danger alert-dismissible fade show" role="alert">
        {{ vm.error }}
        <button type="button" class="close" ng-click="vm.closeAlert()" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    <table class="table responsive">
        <tr ng-repeat="bookmark in vm.bookmarks">
            <td>
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">{{ bookmark.title }}</h5>
                        <p class="card-text">{{ bookmark.description }}</p>
                        <p class="card-text">{{ bookmark.url }}</p>
                        <div class="text-center">
                            <a class="btn btn-outline-primary" href="{{ bookmark.url }}">Go!</a>
                            <a class="btn btn-outline-warning" ui-sref="bookmarksEdit({ id:bookmark.id })">Edit</a>
                            <a class="btn btn-outline-danger" ng-click="vm.remove(bookmark)">Delete</a>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</div>
